package com.woody.aggregate.domain.msgsendrule;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woody.aggregate.infrastructure.msgsendrule.dto.MsgSendRuleInfoDTO;
import com.woody.aggregate.infrastructure.msgsendrule.entity.MsgSendRule;
import com.woody.aggregate.infrastructure.msgsendrule.mapper.MsgSendRuleMapper;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * &copy; All rights Reserved
 *
 * @author wénkǎi.zhāng 2025-03-21
 */
@Component
public class MsgSendRuleManager extends ServiceImpl<MsgSendRuleMapper, MsgSendRule> {


    /**
     * 根据规则id，查询规则详情
     * <br />
     * @param ruleId
     * @return
     */
    public MsgSendRuleInfoDTO getMsgSendRuleDtoByRuleId(Integer ruleId) {
        return getBaseMapper().getMsgSendRuleDtoByRuleId(ruleId);
    }

    /**
     * 分页查询规则列表
     * <br />
     * @param page
     * @param categoryId
     * @param ruleName
     * @return
     */
    public Page<MsgSendRuleInfoDTO> pageQuerySendRule(Page page, Integer categoryId, String ruleName) {
        return getBaseMapper().pageQuerySendRule(page, categoryId, ruleName);
    }

    /**
     * 查询绑定规则的分类id列表
     * <br />
     * @param categoryIds
     * @return
     */
    public List<Integer> selectUsedCategoryIds(List<Integer> categoryIds) {
        return getBaseMapper().selectUsedCategoryIds(categoryIds);
    }
}
